<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/jsp/common/include/taglibs.jsp"%>
<%

String urlParam = "";
urlParam = "?"+request.getQueryString();
 
// String[] emailList = { "yoon-hye-ryeon@nate.com" };// 메일 보낼사람 리스트 
String[] emailList = { "dusdl25@gmail.com" };// 메일 보낼사람 리스트
String emailFromAddress = "chejug@gmail.com";// 메일 보내는 사람
String emailMsgTxt = ""; // 내용

if("re".equals(request.getParameter("type"))){
	emailMsgTxt+="리쿠르팅 요청\n";
}else{
	emailMsgTxt+="컨설팅 요청\n";
}

emailMsgTxt+="접속자 아이피 : " + request.getRemoteAddr()+"\n\n";



// emailMsgTxt+="url : " + urlParam+"\n";
// emailMsgTxt+="이전페이지  : " + request.getHeader("REFERER")+"\n";
emailMsgTxt+="성명 : " + request.getParameter("usr_nm")+"\n";
emailMsgTxt+="생년월일 : " + request.getParameter("birthday")+", 성별 :  ";
if("1".equals(request.getParameter("sex"))){
	emailMsgTxt+="남 \n";
}else{
	emailMsgTxt+="여 \n";
}
emailMsgTxt+="휴대폰 : " + request.getParameter("phone1")+"-"+ request.getParameter("phone2")+"-"+ request.getParameter("phone3")+"\n";
emailMsgTxt+="이메일 : " + request.getParameter("email1")+"@"+request.getParameter("email2")+"\n";
emailMsgTxt+="주소 : " + request.getParameter("addr")+"\n";

if("re".equals(request.getParameter("type"))){
	
	emailMsgTxt+="대학교 : " + request.getParameter("dsc")+"\n";
	emailMsgTxt+="학과 : " + request.getParameter("hr")+", ";
	if("1".equals(request.getParameter("hr_gubun"))){
		emailMsgTxt+="졸업"+"\n";
	}else{
		emailMsgTxt+="졸업예정 "+"\n";
	}
}else{
	
	emailMsgTxt+="직업 : " + request.getParameter("worker")+"\n";
	emailMsgTxt+="상담분야 : " ;
	if("Y".equals( request.getParameter("cs1"))){
		emailMsgTxt+=",종합재무설계 " ;
	}
	if("Y".equals( request.getParameter("cs2"))){
		emailMsgTxt+=",노후준비 " ;
	}
	if("Y".equals( request.getParameter("cs3"))){
		emailMsgTxt+=",보험설계 및 보험리모델링 " ;
	}
	emailMsgTxt+="\n" ;
	emailMsgTxt+="연락가능한 시간 : " + request.getParameter("time1")+" "+ request.getParameter("time2")+"\n";
	emailMsgTxt+="문의 내용 \n" + request.getParameter("questions")+"\n";

}

String emailSubjectTxt = "재무설계 요청 ";// 제목
if("re".equals(request.getParameter("type"))){
	emailSubjectTxt = "리쿠르팅 요청 ";// 제목
}

emailMsgTxt = new String(emailMsgTxt.getBytes("euc-kr"), "8859_1");
kr.co.pension.utils.MailUtil  nMail = new kr.co.pension.utils.MailUtil();
// 메일보내기
try{
	nMail.postMail(emailList, emailSubjectTxt, emailMsgTxt, emailFromAddress);	
}catch(Exception e){
// 	out.println("====error====");
}


%>
<html>
<head>
<meta charset="UTF-8">
<title>상담 요청 성공</title>
<script type="text/javascript">
<%
if("re".equals(request.getParameter("type"))){
	out.println("alert('완료 했습니다.');");
}else{
	out.println("alert('상담 요청을 완료 했습니다.');");
}
%>

self.close();
</script>
</head>
<body>
<!-- 	상담 요청을 완료 했습니다. -->
</body>
</html>
